/****************************************************
    ScriptName:        PauseMenu

    Author:            86191
    CreatTime:    2020/12/15 19:6:15
    Description:     nothing
*****************************************************/

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;


namespace HXY
{
    public class PauseMenu : MonoBehaviour
    {
        public static bool GameIsPaused = false;
        public GameObject pauseMenuUI;
        // Start is called before the first frame update
        void Start()
        {

        }

        // Update is called once per frame
        void Update()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (GameIsPaused)
                {
                    Resume();
                }
                else
                {
                    Pause();
                }
            }
        }
        public void Resume()
        {
            TapTapStaticValue.PlaySound();
            Cursor.visible = false;
            pauseMenuUI.SetActive(false);
            Time.timeScale = 1.0f;
            GameIsPaused = false;
        }
        public void music()
        {

        }
        public void Pause()
        {
            Cursor.visible = true;
            pauseMenuUI.SetActive(true);
            Time.timeScale = 0.0f;
            GameIsPaused = true;
        }
        public void MainMenu()
        {
            TapTapStaticValue.PlaySound();
            GameIsPaused = false;
            Time.timeScale = 1.0f;
            SceneManager.LoadScene("Start Menu");
        }
        public void QuitGame()
        {
            Application.Quit();
        }

    }
}


